<!--全局设置-->
<?php 
include('config.php'); 
$tips = '全局设置';
include('admincore.php');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="/layui/css/layui.css"/>
		<?php include('inc.php'); ?>
		<script type="text/javascript" src="./js/jquery.js"></script>
		<script type="text/javascript" src="./js/jquery.dragsort-0.4.min.js"></script>
	</head>
<body>
	<?php $nav = 'setting';include('head.php'); ?>
	
	<div id="hd_main">
		<div class="hd_bj">
			<div class="hd_bt" style="background:url(images/zu.png);background-position: center top;background-size:contain;width: 100%;height: 110px;">
			</div> 
			<div align="center" style="color: #FFFFFF;position: absolute;top: 50px;left: 500px;font-size: 30px;"><?php echo $tips?></div>

            <form class="layui-form" action="./setting.php?act=setting&t=<?php echo time()?>" method="post" onsubmit="return subck()">
                <fieldset class="layui-elem-field">
                    <legend>基本设置</legend>
                    <div class="layui-field-box">
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站名称：</label>
                            <div class="layui-input-inline">
                                <input name="edit" id="edit" type="hidden" value="1" />
                                <input type="text" name="aik[sitename]" class="layui-input" value="<?php echo $aik['sitename']?>" size="50" >
                            </div>
                            <div class="layui-form-mid layui-word-aux">如：<?php echo $aik['title'];?></div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">网站域名：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="aik[pcdomain]" class="layui-input" id="aik_pcdomain" value="<?php echo $aik['pcdomain']?>" size="50">
                            </div>
                            <div class="layui-form-mid layui-word-aux">网站域名，如 <?php echo $_SERVER['HTTP_HOST']?></div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">首页标题：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="aik[title]" class="layui-input" value="<?php echo $aik['title']?>" size="50">
                            </div>
                            <div class="layui-form-mid layui-word-aux">显示在首页标题上，一般不超过80个字符</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">首页关键字：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[keywords]" class="layui-textarea"><?php echo $aik['keywords']?></textarea>
                                <div class="layui-form-mid layui-word-aux">关键字请用英文逗号分开，一般不超过100个字符</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">首页描述：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[description]" class="layui-textarea"><?php echo $aik['description']?></textarea>
                                <div class="layui-form-mid layui-word-aux">一般不超过200个字符</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">微博：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="aik[weibourl]" placeholder="请输入您的微博链接" class="layui-input" value="<?php echo $aik['weibourl']?>" size="50"><br/>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">首页公告：</label>
                            <div class="layui-input-inline">
                                <textarea name="aik[gonggao]" class="layui-textarea"><?php echo $aik['gonggao']?></textarea>
                                <div class="layui-form-mid layui-word-aux">一般不超过100个字符</div>
                            </div>
                            <div class="layui-input-inline">
                                <textarea name="aik[gonggaourl]" class="layui-textarea"><?php echo $aik['gonggaourl']?></textarea>
                                <div class="layui-form-mid layui-word-aux">公告链接，无链接地址请留空！</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">默认播放：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="aik[maurl]" class="layui-input" value="<?php echo $aik['maurl']?>" size="50"><br/>
                            </div>
                            <div class="layui-form-mid layui-word-aux">页面打开默认播放视频<font color="red">（第一条是默认调用接口）</font></div>
                        </div>
                    </div>
                </fieldset>

                <fieldset class="layui-elem-field">
                    <legend>API设置</legend>
                    <div class="layui-field-box">
                            <?php
                                $i = 0;
                                foreach ($aik[apiUrl] as $key1 => $value1) {
                                    $i++;
                                    echo "<div class=\"layui-form-item\"><label class=\"layui-form-label\">接口{$i}：</label>";
                                    foreach ($value1 as $key2 => $value2) {
                                        echo "<div class=\"layui-input-inline\">";
                                        echo "<input type=\"text\" name=\"aik[apiUrl][".($i-1)."][$key2].$key2\" class=\"layui-input\" value='{$value2}' size=\"50\">";
                                        echo "</div>";
                                    }
                                    echo "<button type='button' onclick='removeApi(this)' class=\"layui-btn layui-btn-sm layui-btn-danger\">删除</button></div>";
                                }
                            ?>

                        <div class="layui-form-item">
                            <label class="layui-form-label"><button type="button" class="layui-btn layui-btn-sm" id="addApi">添加</button></label>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">导航设置：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[topnav]" class="layui-textarea"><?php echo $aik['topnav']?></textarea>
                                <div class="layui-form-mid layui-word-aux">不添加可留空。新增导航链接，图标：请添加在li下面'<xmp style="display: inline-block;background: #FA584E;color: #fff;font-size: 9px;"><span class="ico-new"></span></xmp>'</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">侧滑广告：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[ch1]" class="layui-textarea"><?php echo $aik['ch1']?></textarea>
                                <div class="layui-form-mid layui-word-aux">不开启请留空</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">播放器下方广告：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[guanggao]" class="layui-textarea"><?php echo $aik['guanggao']?></textarea>
                                <div class="layui-form-mid layui-word-aux">不开启请留空</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">畅言配置：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[changyan]" class="layui-textarea"><?php echo $aik['changyan']?></textarea>
                                <div class="layui-form-mid layui-word-aux">可自定义配置，如无需配置请留空<a href="http://changyan.kuaizhan.com" target="_blank">畅言配置点击</a></div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">友情链接：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[homelink]" class="layui-textarea"><?php echo $aik['homelink']?></textarea>
                                <div class="layui-form-mid layui-word-aux">不开启请留空</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">ICP备案号：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[icp]" class="layui-textarea"><?php echo $aik['icp']?></textarea>
                                <div class="layui-form-mid layui-word-aux">不开启请留空</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">版权说明：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[foot]" class="layui-textarea"><?php echo $aik['foot']?></textarea>
                                <div class="layui-form-mid layui-word-aux">不开启请留空</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">版本号：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[version]" class="layui-textarea"><?php echo $aik['version']?></textarea>
                                <div class="layui-form-mid layui-word-aux">不开启请留空</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">统计信息：</label>
                            <div class="layui-input-block">
                                <textarea name="aik[tongji]" class="layui-textarea"><?php $aik['tongji'] = str_replace("\\'","'",$aik['tongji']);echo htmlspecialchars($aik['tongji'])?></textarea>
                                <div class="layui-form-mid layui-word-aux">不开启请留空</div>
                            </div>
                        </div>
                    </div>
                </fieldset>

                <fieldset class="layui-elem-field">
                    <legend>账号设置</legend>
                    <div class="layui-field-box">
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="aik[admin_name]" class="layui-input" value="<?php echo $aik['admin_name']?>" size="50">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">登录密码：</label>
                            <div class="layui-input-inline">
                                <input type="password" name="aik[admin_pass]" class="layui-input" value="" size="50">
                            </div>
                            <div class="layui-form-mid layui-word-aux">不修改请留空</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">管理员邮箱：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="aik[admin_email]" class="layui-input" value="<?php echo $aik['admin_email']?>" size="50">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">管理员QQ：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="aik[admin_qq]" class="layui-input" value="<?php echo $aik['admin_qq']?>" size="50">
                            </div>
                        </div>
                    </div>
                </fieldset>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    </div>
                </div>
            </form>
			<script type="text/javascript">
				$(".sxlist:first").dragsort();
			</script>
		</div>
	</div>

<script type="text/javascript">
    layui.use(['form','jquery'], function(){
        var form = layui.form,$ = layui.jquery;
        $('#addApi').on('click',function () {
            var size = window.Play_size || <?php echo $i?>;
            window.Play_size = size + 1;
            var append = ['<div class="layui-form-item"><label class="layui-form-label">接口'+ window.Play_size +'：</label>',
                '<div class="layui-input-inline">',
                '<input type="text" name="aik[apiUrl]['+ (parseInt(window.Play_size) - 1) +'][name].name" class="layui-input" value="" size="50"></div>',
                '<div class="layui-input-inline">',
                '<input type="text" name="aik[apiUrl]['+ (parseInt(window.Play_size) - 1) +'][url].url" class="layui-input" value="" size="50"></div>',
                '<button type="button" onclick="removeApi(this)" class="layui-btn layui-btn-sm layui-btn-danger">删除</button></div>',
                '</div>'];
            $(this).parent().parent().before(append.join(''));
        })
    });
    function removeApi(e) {
        e.parentNode.remove();
        window.Play_size && (window.Play_size-= 1);
    }
</script>
</body>
</html>